/*
 *  Continent.cpp
 *  RiskAI
 *
 *  Created by Chris on 11/14/09.
 *  Copyright 2009 __MyCompanyName__. All rights reserved.
 *
 */

#include "Continent.h"
#include "Board.h"

#include <vector>

using namespace std;

//**********************************************************************************
//				CONSTRUCTION/DESTRUCTION
//**********************************************************************************

CContinent::CContinent(CBoard* pxBoard)
	: m_pxBoard(pxBoard)
{
}

CContinent::~CContinent()
{
}




//**********************************************************************************
//				SETUP
//**********************************************************************************

void
CContinent::AddTerritory(int iTerritory)
{
	m_viTerritories.push_back(iTerritory);
}

//==================================================================================

void
CContinent::SetBonus(int iBonus)
{
	m_iBonus = iBonus;
}




//**********************************************************************************
//				FUNCTIONALITY
//**********************************************************************************

int
CContinent::GetBonusForPlayer(int iPlayer)
{
	for(unsigned int i=0; i<m_viTerritories.size(); i++)
	{
		if(m_pxBoard->GetTerritory(m_viTerritories[i])->GetOwner() != iPlayer)
			return 0;
	}
	
	return m_iBonus;
}
